package com.paisheng.justlife.activity;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;

import com.paisheng.justlife.R;

public class ClaimGoodsActivity extends Activity {
    MyBroadCastReceive myBroadCastReceive;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_claim_goods);
        IntentFilter filter = new IntentFilter();
        myBroadCastReceive = new MyBroadCastReceive();
        filter.addAction("SerialService.on-off");
        registerReceiver(myBroadCastReceive,filter);

    }


    class MyBroadCastReceive extends BroadcastReceiver {
        @Override
        public void onReceive(Context context, Intent intent) {
            boolean flag = intent.getBooleanExtra("flag",true);
            if(flag){
                startActivity(new Intent(ClaimGoodsActivity.this,CloseBoorActivity.class));
            }

        }
    }


    @Override
    protected void onPause() {
        super.onPause();
        unregisterReceiver(myBroadCastReceive);
        finish();
    }
}
